<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>FE - react - base</title>
  <script src="https://unpkg.com/react@17/umd/react.development.js"></script>
  <script src="https://unpkg.com/react-dom@17/umd/react-dom.development.js"></script>
  <script src="https://cdn.staticfile.org/babel-standalone/6.26.0/babel.min.js"></script>
</head>
<body>
  

  <div id="example"></div>
  <script type="text/babel">
    // 1.创建类式组件
    class MyComponent extends React.Component{
      state = {
        isHot: true
      }
      render(){
        const {isHot} = this.state
        return <h3 onClick={this.changeState}>比赛{isHot?'开始了':'结束了'}</h3>
      }
      changeState=()=>{
        const isHot = !this.state.isHot
        this.setState({isHot:isHot})
      }
    }

    ReactDOM.render(<MyComponent/>, document.getElementById('example'))




    // 简单组件：无状态
    // 复杂组件：有状态
  </script>

</body>
</html>